<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			table {
				border: 1px solid orange;
				width: 600px;
				border-collapse: collapse;
			}

			table td {
				border: 1px solid orange;
				padding: 10px;
			}
		</style>
		<script type="text/javascript">
			window.addEventListener('DOMContentLoaded', function() {
				var button = document.querySelector('button');
				button.addEventListener('click', function() {
					var inputs = document.querySelectorAll('input');
					// console.log(inputs[0].value);
					// console.log(inputs[1].value);
					var table = document.querySelector('table');
					for (var i = 0; i < inputs[0].value; i++) {
						var tr = document.createElement('tr');
						// var tr = table.insertRow();
						for (var j = 0; j < inputs[1].value; j++) {
							var td = document.createElement('td');
							// var td = tr.insertCell();
							td.innerHTML = i + "," + j;
							tr.appendChild(td);
						}
						table.appendChild(tr);
					}
					
					console.log(table.rows);
					// console.log(tr.cells);
				})
			})
		</script>
	</head>
	<body>
		行<input type="text" />
		列<input type="text" />
		<button>生成表格</button>
		<hr />
		<table>

		</table>
	</body>
</html>
